import { Component, OnInit } from '@angular/core';
import {MemberService} from "../../myService/service.component";

@Component({
  selector: 'select-basic',
  templateUrl: './book.component.html',
  styleUrls: ['./book.component.css']
})
export class BookComponent implements OnInit {
  books = [];
  test:string = "123";
  constructor(private ProductHttp:MemberService){}
  ngOnInit(){
    // this.ProductHttp.getsevice().subscribe(
    //   res => {
    //     console.log('res', res);
    //     this.books = res;
    //   }
    // )

    // var res = this.ProductHttp.getsevice();
    // console.log('sss', res)

    this.ProductHttp.getsevice(); // 发布
    this.ProductHttp.testSubject.subscribe(
      data => {
        console.log('我是订阅到的', data)
            this.books = data;
      }
    )
  }

}
